package net.zdsoft.wpchat.android.client;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;

/**
 * 获取Bean工厂类
 * 
 * @author xuan
 * @version $Revision: 1.0 $, $Date: 2014-5-30 下午2:09:08 $
 */
public class ServiceLocator implements BeanFactoryAware {
    private static BeanFactory beanFactory = null;

    @Override
    public void setBeanFactory(BeanFactory factory) throws BeansException {
        ServiceLocator.beanFactory = factory;
    }

    /**
     * 获取bean
     * 
     * @param name
     * @return
     */
    public static Object getBean(Class<?> clazz) {
        return beanFactory.getBean(clazz);
    }

}
